package implement

import "fmt"

// Eat 门面调用者
func Eat(animal Animal) string {
	return animal.eat()
}

// Animal 多态 通过接口调用实现类的具体方法
type Animal interface {
	eat() string
}

type Cat struct {
}

func (c *Cat) eat() string {
	return fmt.Sprintf("cat eating")
}

type Dog struct {
}

func (d *Dog) eat() string {
	return fmt.Sprintf("dog eating")
}
